home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / w00os / shared / src / print.asm < prev   
Encoding:
Assembly Source File  |  1998-12-31  |  2.3 KB  |  94 lines

  1. ; this file has functions to output/prepare messages
  2. ; ---------------------------------------------------
  3.  
  4. ;---------------------------------------------------------
  5. ; clear the screen 
  6. ;---------------------------------------------------------
  7. clearscreen:
  8.     push ax
  9.  
  10.     xor ax,ax        ; clear/empty ax
  11.     mov al,3        ; set it to mode 3
  12.     int 10h            ; video interrupt
  13.  
  14.     pop ax
  15.     ret
  16.  
  17.  
  18. ;---------------------------------------------------------
  19. ; print the startup messages
  20. ;---------------------------------------------------------
  21. printbootmsgs:
  22.     push dx            ; save the old values
  23.     push si
  24.  
  25.     mov si,bootmsg        ; load the bootup message into ds:si
  26.     call printmsg        ; display message to screen
  27.  
  28.     cmp dl,0x80        ; Compare the boot drive to 0x80 (C: drive)
  29.     jae short printhd    ; If dl (boot drive) <= 0x80 (C: drive) jmp
  30.  
  31.     add dl,'A'        ; drive # we booted off in dl (if floppy)
  32.  
  33.  
  34. printbootmsgs1:
  35.     call printdrv
  36.  
  37.     pop si            ; restore the old values
  38.     pop dx
  39.  
  40.     ret            ; return from this function
  41.  
  42. ;--------------------------------------------------------
  43. ; used when the boot drive was a hard drive (ie C:)    
  44. ;--------------------------------------------------------
  45.  
  46. printhd:
  47.     sub dl,0x3d            ; 0x80 - 0x3d = 0x43 (C: drive)
  48.     jmp short printbootmsgs1    ; jump back to printbootmsgs
  49.  
  50.  
  51. ;---------------------------------------------------------
  52. ; output the actual boot drive message to the screen
  53. ;---------------------------------------------------------
  54.  
  55. printdrv:            ; used to print drive # (for all types)
  56.     mov byte [bootdrv],dl    ; put the boot drive # into bootdrv
  57.  
  58.     mov si,bootdrv        ; put the drive # in ds:si for printmsg
  59.     call printmsg        ; print the drive # to the screen
  60.  
  61.     ret            ; return from this function
  62.  
  63.  
  64. ;--------------------------------------------------------
  65. ; print a message to the screen using the video interrupt
  66. ;--------------------------------------------------------
  67.  
  68. printmsg:
  69.     push ax            ; save the old values
  70.     push bx
  71.     push si
  72.  
  73. .printmsg1:
  74.     cld            ; clear the direction flag
  75.  
  76.     lodsb            ; read one byte from ds:si into al at a time
  77.     or al,al        ; test if al is 0 (indicating end of str)
  78.      jz short printdone    ; if it is 0, end (return)
  79.  
  80.     mov ah,0eh        ; print a character to screen 
  81.     mov bh,0        ; page 0 of screen (normal page)
  82.     int 10h            ; BIOS video interrupt
  83.  
  84.     jmp short .printmsg1
  85.  
  86. done:    ret            ; done here is used by several functions
  87.  
  88. printdone:
  89.     pop si            ; save the old values
  90.     pop bx
  91.     pop ax
  92.  
  93.     ret
  94.